//
//  HOTMessageChatForSendCell.m
//  Genpara
//
//  Created by zhang chunhui on 14-9-27.
//  Copyright (c) 2014年 zhangchh. All rights reserved.
//

#import "HOTMessageChatForSendImage.h"
#import "UIImageView+AFNetworking.h"
#import "HOTImagePriviewer.h"

@interface HOTMessageChatForSendImage() {
    
    
}
@property(nonatomic,strong)NSDictionary *cellInfo;
@end

@implementation HOTMessageChatForSendImage



- (void)awakeFromNib
{
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    _sendBgImageView.image = [_sendBgImageView.image stretchableImageWithLeftCapWidth:20 topCapHeight:13];
    _sendBgImageView.userInteractionEnabled = YES;
    UITapGestureRecognizer *tgr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView)];
    [tgr setNumberOfTapsRequired:1];
    [tgr setNumberOfTouchesRequired:1];
    
    [_sendBgImageView addGestureRecognizer:tgr];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)setImageContentInfo:(NSDictionary *)info {
    
    self.cellInfo = info;
    id image = [info objectForKey:@"pic_thumb_url"];
    
    if ([info objectForKey:@"isLocal"]) {
        
        self.upImageView.image = image;
    } else {
    
        [self.upImageView setImageWithURL:[NSURL URLWithString:image] placeholderImage:nil];
    }
}

-(void)tapImageView {
    
    HOTImagePriviewer *priviewer = [HOTImagePriviewer priviewer];
    [priviewer showInView:[[UIApplication sharedApplication] keyWindow] withUrl:[self.cellInfo objectForKey:@"pic_url"] placeHolder:self.upImageView.image];
}

@end
